package com.wiscamp.ninechapters.problems.math;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 四边形表示
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class LatexQuadrangleDenote extends LatexGeometryDenote {
    /**
     * 起始顶点
     */
    private char startVertex;

    /**
     * 第二顶点
     */
    private char middleOneVertex;

    /**
     * 第三顶点
     */
    private char middleTwoVertex;

    /**
     * 结束顶点
     */
    private char endVertex;


    public String getLatex() {
        String temp = String.valueOf(startVertex) + middleOneVertex + middleTwoVertex + endVertex;
        return temp.toUpperCase();
    }

    public LatexQuadrangleDenote(char startVertex, char middleOneVertex, char middleTwoVertex, char endVertex) {
        this.startVertex = startVertex;
        this.middleOneVertex = middleOneVertex;
        this.middleTwoVertex = middleTwoVertex;
        this.endVertex = endVertex;
    }

    public LatexQuadrangleDenote(String content) {
        var chars = content.toCharArray();
        if (chars.length == 4) {
            this.startVertex = chars[0];
            this.middleOneVertex = chars[1];
            this.middleTwoVertex = chars[2];
            this.endVertex = chars[3];
        }
    }

}
